package appconfig

import (
	"fmt"
	"github.com/spf13/viper"
)

type AppConfig struct {
	MysqlConfig
	RedisConfig
}

type MysqlConfig struct {
	User     string
	Pass     string
	Host     string
	Port     int
	Database string
}

type RedisConfig struct {
	Host     string
	Password string
	Db       int
}

var AppConf AppConfig

func InitApp() {
	viper.SetConfigFile("./appconfig/dev.yaml")
	viper.ReadInConfig()
	viper.Unmarshal(&AppConf)
	fmt.Println("动态配置为:", AppConf)
}
